/* Original Author:  Dominick O'Dierno
 * Date: 2007   odiernod@gmail.com     --Originally intended for use with DOMercury:  http://www.odierno.com/domercury
 * Description: Provides an interface to provide IItems to the DOMercury index
 * 
 * --CHANGELOG--
 * 
 * */
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace DOMercury.Interfaces
{
    public interface IItemProvider
    {
        /// <summary>
        /// The name of your IItemProvider
        /// </summary>
        string Name
        {
            get;
        }
        /// <summary>
        /// The description of your IItemProvider
        /// </summary>
        string Description
        {
            get;
        }

        /// <summary>
        /// A list of items to add to DOMercury's index
        /// </summary>
        List<IItem> Items
        {
            get;
        }

        /// <summary>
        /// A list of custom icons to use with the items in your provider.  If unused, return an empty list.
        /// </summary>
        List<IconPair> CustomIcons
        {
            get;
        }

        /// <summary>
        /// Indicates whether or not this plugin has an options form.  Return false if not supplying an options form
        /// </summary>
        bool HasOptions
        {
            get;
        }

        /// <summary>
        /// This is the function that gets called when the user hits the "Show Options" but in the Plugin Details form.  You should call "ShowDialog" on your options form here.
        /// </summary>
        void ShowOptions();
    }

    /// <summary>
    /// Needs to be above every class implementing the IPlugin Interface
    /// </summary>
    [AttributeUsage(AttributeTargets.Class)]
    public class DOMercuryPlugInAttribute : Attribute
    {
        /// <summary>
        /// The only costructor available
        /// </summary>
        /// <param name="Description">No longer used.</param>
        public DOMercuryPlugInAttribute(string Description)
        {
            desc = Description;
        }

        private string desc;
        /// <summary>
        /// Not used
        /// </summary>
        public string Description
        {
            get 
            { 
                return desc; 
            }
            set 
            { 
                desc = value; 
            }
        }
    }

    public class IconPair
    {
        private Bitmap _icon;
        private string key;

        /// <summary>
        /// A custom Icon matched to its key, which is the ItemDesc of the item for which this icon will be matched.
        /// </summary>
        /// <param name="IconKey">The ItemDesc of the icon this item will be matched to (Case Sensitive)</param>
        /// <param name="IconImage">The bitmap of the icon</param>
        public IconPair(string IconKey, Bitmap IconImage)
        {
            _icon = IconImage;
            key = IconKey;
        }

        public string Key
        {
            get
            {
                return key;
            }
        }

        public Bitmap Icon
        {
            get
            {
                return _icon;
            }
        }
    }
}
